<!--
 * @Author: fengYM feng25321@163.com
 * @Date: 2023-09-19 14:56:48
 * @LastEditors: fengYM feng25321@163.com
 * @LastEditTime: 2023-10-13 15:11:32
 * @Description: 修改支付密码
-->
<template>
  <view class="edit_box">
    <view class="edit_box_title">输入信息</view>
    <u-input v-model="formData.payPsw" placeholder="输入密码" border="bottom" :password="isPass">
      <template #suffix>
        <u-icon name="eye-off" color="#bfbfbf" size="28" v-if="isPass" @click="isPass = false"></u-icon>
        <u-icon name="eye" color="#bfbfbf" size="28" v-else @click="isPass = true"></u-icon>
      </template>
    </u-input>
    <view class="bottomBox">
      <u-button type="primary" @click="submit" color="#71cec5">提交</u-button>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { updateUserPayPsw } from "@/api/my";
const formData = ref({
  payPsw: "",
  userId: uni.getStorageSync("userId"),
});
const isPass = ref(true);
const submit = async () => {
  await updateUserPayPsw(formData.value);
  uni.showToast({
    title: "修改成功",
    icon: "success",
    duration: 2000,
    complete() {
      setTimeout(() => {
        uni.navigateBack();
      }, 1000);
    },
  });
};
</script>

<style lang="less" scoped>
@import "./edit.less";

/deep/.u-input {
  padding: 34rpx 0px !important;
}
</style>
